﻿using BXS.API.Models;
using Microsoft.AspNetCore.Mvc;

namespace BXS.API.Controllers
{
    /// <summary>
    /// 健康检查控制器
    /// </summary>
    public class HealthController : BaseController
    {
        private readonly ILogger<HealthController> _logger;

        public HealthController(ILogger<HealthController> logger)
        {
            _logger = logger;
        }

        /// <summary>
        /// 健康检查
        /// </summary>
        /// <returns>健康状态</returns>
        [HttpGet]
        public ActionResult<ApiResponse<dynamic>> Get()
        {
            _logger.LogInformation("健康检查请求");

            dynamic healthInfo = new Dictionary<string, object>
            {
                ["Status"] = "Healthy",
                ["Timestamp"] = DateTime.UtcNow,
                ["Version"] = "1.0.0",
                ["Environment"] = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development"
            };

            return Success(healthInfo, "服务运行正常");
        }
    }
}